package it.stessaro.lostcities.collection;
import it.stessaro.lostcities.core.Costants;

import java.awt.Color;

public class Card implements Comparable<Card>{

	private int value;
	private int color;
	private boolean toPlay;
	
	public Card(int number, int intColor){
		this.value = number;
		this.color = intColor;
		this.setToPlay(true);
	}
	
	public String getColorStr(){
		if ( color == Costants.RED ) {
			return "r";
		}else if ( color == Costants.YELLOW ) {
			return "y";
		}else if ( color == Costants.GREEN ) {
			return "g";
		}else if ( color == Costants.WHITE ) {
			return "w";
		}else{
			return "b";
		}
	}
	
	public Color getAWTColor(){
		if ( color == Costants.RED ) {
			return Color.red;
		}else if ( color == Costants.YELLOW ) {
			return Color.yellow;
		}else if ( color == Costants.GREEN ) {
			return Color.green;
		}else if ( color == Costants.WHITE ) {
			return Color.white;
		}else if ( color == Costants.BLUE ) {
			return Color.cyan;
		}else{
			return Color.black;
		}
	}
	public int getCardColor(){
		return color;
	}
	
	public String getNumberString(){
		if (value == 1) {
			return "*";
		}
		return Integer.toString(value);
	}
	
	public String toString(){
		return this.getNumberString().concat(this.getColorStr());
	}
	
	public int getCardValue(){
		return value;
	}
		
	public void print(){
		System.out.print(value+this.getColorStr()+" ");
	}

	@Override
	public int compareTo(Card comp_card) {
		return this.value - comp_card.value;
	}

	public boolean isToPlay() {
		return toPlay;
	}

	public void setToPlay(boolean toPlay) {
		this.toPlay = toPlay;
	}
}